'use strict';
angular.module('stmms')
    .config(['$stateProvider', '$urlRouterProvider', '$httpProvider',function ($stateProvider, $urlRouterProvider, $httpProvider) {
        $httpProvider.defaults.useXDomain = true;
        delete $httpProvider.defaults.headers.common['X-Requested-With'];

        //
        // For any unmatched url, redirect to /state1
        $urlRouterProvider.otherwise("/home");
        //
        // Now set up the states
        $stateProvider
            
            .state('mark',{
                url:'/mark/:workId',
                abstract:true,
                params:{
                    workId:'@workId'
                },
                templateUrl: "pages/mark/mark.html"
            })
            .state('mark.subjects', {
                url: "/subjects",
                templateUrl: "pages/mark/mark.subjects.html",
                controller:'SubjectCtrl'
            })
            .state('mark.markers', {
                url: "/markers",
                params:{
                    workId:'@workId'
                },
                templateUrl: "pages/mark/mark.markers.html",
                controller:'MarkerCtrl'
            })
            .state('mark.markerdetail', {
                url: "/markers/:markerId/detail",
                params:{
                    markerId:'@markerId'
                },
                templateUrl: "pages/mark/mark.markers.detail.html",
                controller:'MarkerDetailCtrl'
            })
            .state('mark.markertasks', {
                url: "/markers/:markerId/tasks",
                params:{
                    markerId:'@markerId'
                },
                templateUrl: "pages/mark/mark.markers.tasks.html",
                controller:'MarkerTasksCtrl'
            })
            .state('mark.taskpapers', {
                url: "/marker/:markerId/tasks/:taskId/papers",
                params:{
                    markerId:'@markerId',
                    taskId:'@taskId'
                },
                templateUrl: "pages/mark/mark.papers.html",
                controller:'TaskPapersCtrl'
            })
            .state('works', {
                url: "/works",
                templateUrl: "pages/mark-work.html",
                controller:'IndexCtrl'
            })
            .state('home', {
                url: "/home",
                templateUrl: "pages/home.html",
                controller:'HomeCtrl'
            })
            .state('paper', {
                url: "/paper",
                templateUrl: "pages/paper.html",
                controller:'PaperCtrl'
            });
    }])